using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Calendar.UI
{
    public partial class frmAlertMilestoneConflict : Form
    {
        DataTable dtTasks;
        public frmAlertMilestoneConflict()
        {
            InitializeComponent();
        }

        public frmAlertMilestoneConflict(DataTable dt)
        {
            InitializeComponent();
            this.dtTasks = dt;
            this.WindowState = FormWindowState.Normal;
        }


        private void frmAlertMilestoneConflict_Load(object sender, EventArgs e)
        {

            ShowTaskDetail();
            this.WindowState = FormWindowState.Normal;
            GlobalInfo.AlertFamcShownOnce = true;
        }

        private void ShowTaskDetail()
        {
            int i4dtTasks = 0;
            txtPrj.Text = dtTasks.Rows[i4dtTasks]["projectname"].ToString();
            txtMilestone1.Text = dtTasks.Rows[i4dtTasks]["milestone1"].ToString();
            txtMilestone2.Text = dtTasks.Rows[i4dtTasks]["milestone2"].ToString();
            txtPM.Text = dtTasks.Rows[i4dtTasks]["PM"].ToString();
            txtDesc.Text = "A task '" + dtTasks.Rows[i4dtTasks]["t2desc"].ToString() + "' of milestone '" + dtTasks.Rows[i4dtTasks]["milestone2"].ToString() + "' is dependent on task '" + dtTasks.Rows[i4dtTasks]["t1desc"].ToString() + "' of milestone '" + dtTasks.Rows[i4dtTasks]["milestone1"].ToString() + "', task '" + dtTasks.Rows[i4dtTasks]["t1desc"].ToString() + "' is not completed yet, so milestone '" + dtTasks.Rows[i4dtTasks]["milestone1"].ToString() + "' is delayed and task '" + dtTasks.Rows[i4dtTasks]["t2desc"].ToString() + "' could not start, hence creating milestone conflict";
            txtToday.Text = DateTime.Now.ToString("dd-MMM-yyyy");
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            frmAlertController.famc = null;
            this.Dispose();
        }

        private void txtMinutes_TextChanged(object sender, EventArgs e)
        {

        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            frmAlertController.famc = null;
            this.Dispose();
        }

        private void btnDisableTemp_Click(object sender, EventArgs e)
        {
            InputBoxResult test = InputBox.Show("Please enter no of days for which you want to disable alerts", "Disable alerts temporarily");
            if (test.ReturnCode == DialogResult.OK)
                MessageBox.Show(test.Text);

        }
    }
}